<!---
	Name         : dsp.edit.cfm
	Author       : Raymond Camden 
	Created      : 09/07/05
	Last Updated : 2/23/06
	History      : Use htmleditformat to preserve proper text (rkc 2/23/06)
--->

<cfset newToggle = viewState.getValue("new", false)>

<cfif not newToggle>
	<cfset page = viewState.getValue("page")>
	<cfset viewState.setValue("title","Edit Page: #page.getPath()#")>
	<cfparam name="form.body" default="#page.getBody()#">
<cfelse>
	<cfset viewState.setValue("title","Add Page")>
	<cfparam name="form.body" default="">
	<cfparam name="form.path" default="">
</cfif>

<cfset errors = viewState.getValue("errors")>
<cfset editInstructions = viewState.getValue("editinstructions")>




<!--- param author and summary if editing old version --->
<cfif viewState.getValue("version") neq "0">
	<cfparam name="form.author" default="#page.getAuthor()#">
	<cfparam name="form.summary" default="#page.getSummary()#">
<cfelse>
	<cfparam name="form.author" default="">
	<cfparam name="form.summary" default="">
</cfif>

<cfoutput>
<h3 class="title">#viewState.getValue("title")#</h3>

<cfif isArray(errors) and arrayLen(errors)>
	<p>
	<b>Please correct the following error(s):
	<ul>
	<cfloop index="x" from="1" to="#arrayLen(errors)#">
	<li>#errors[x]#</li>	
	</cfloop>
	</ul>
	</b>
	</p>
</cfif>

<p>
<cfif not newToggle>
	<form action="#cgi.script_name#?path=#page.getPath()#&event=commitPage" method="post">
<cfelse>
	<form action="#cgi.script_name#?event=commitPage&new=true" method="post">
</cfif>
<table>
<cfif newToggle>
<tr>
	<td>
	Page Title:
	</td>
	<td><input type="text" name="path" value="#form.path#"></td>
</tr>
<tr>
	<td>&nbsp;</td>
	<td><i>Please follow the Wiki scheme of naming pages. All letters or numbers and "dot" syntax for sections.<br>
	So for example, here are some valid page names: Foo, Moo, SectionA.Introduction.</i></td>
</tr>
</cfif>
<tr>
	<td colspan="2">
	<textarea name="body" class="textBox">#htmlEditFormat(form.body)#</textarea>
	</td>
</tr>
<tr>
	<td>
	Author:
	</td>
	<td><input type="text" name="author" value="#form.author#"></td>
</tr>
<tr>
	<td>
	Summary:
	</td>
	<td><input type="text" name="summary" value="#form.summary#"></td>
</tr>
<tr>
	<td>&nbsp;</td>
	<td><input type="submit" value="Save"></td>
</tr>
</table>
</form>
</p>

<p>
<h3>Editing Instructions</h3>
#editInstructions#
</p>
</cfoutput>

